import Vue from 'vue';
import Router from 'vue-router';


import Login from '@/components/login';
import PolicyRelease from '@/components/policyRelease';
import CasePublishing from '@/components/casePublishing';
import QuestionBank from '@/components/questionBank';
import CreateQuestion from '@/components/createQuestion';
import CreateCase from '@/components/createCase';
import Insight from '@/components/insight';
import DataDictionary from '@/components/dataDictionary';
import CreatePublishing from '@/components/createPublishing';
import Carousel from '@/components/carousel';
import CreateInsight from '@/components/createInsight';
import ContactConfiguration from '@/components/contactConfiguration';
import Main from '@/components/main';
Vue.use(Router)

const router=new Router({
  routes: [
    {
      path: '/',
      component: Login
    },
    {
      path: '/login',
      component: Login
    },
    {
      path:'/main',
      component:Main,
      children:[
      	{
		      path:'/main/policyRelease',
		      component:PolicyRelease
		    },
		    {
		      path:'/main/casePublishing',
		      component:CasePublishing
		    },
		    {
		      path:'/main/questionBank',
		      component:QuestionBank
		    },
		    {
		      path:'/main/createQuestion',
		      component:CreateQuestion
		    },
		 		{
		      path:'/main/createCase',
		      component:CreateCase
		    },
		    {
		      path:'/main/insight',
		      component:Insight
		    },
		   {
		      path:'/main/dataDictionary',
		      component:DataDictionary
		    },
		    {
		      path:'/main/createPublishing',
		      component:CreatePublishing
		    },
		    {
		      path:'/main/carousel',
		      component:Carousel
		    },
		    {
		      path:'/main/createInsight',
		      component:CreateInsight
		    },
		    {
		      path:'/main/contactConfiguration',
		      component:ContactConfiguration
		    },
      ]
    }
    
  ]
})
//  进入路由前做判断
/*router.beforeEach((to, from, next) => {
  next();
  if (localStorage.getItem('username')) {// 判断是否登录
    next();
  }else {// 没登录则跳转到登录界面
    // next('/login');
  }
})*/
export default router;
